/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.util;

import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

/**
 *
 * @author jasuke
 */
public class MessageUtil implements Serializable {
    FacesMessage msg = null;
    private String message="";
    private static String saveFiled = "Save/update tidak berhasil.";
        
    public MessageUtil() {
        
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
    
    public void messageInfo() {
        if (!getMessage().equals("")) {
            msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", getMessage());
            FacesContext.getCurrentInstance().addMessage(null, msg);  
        }
    }
    
    public void messageSaveFailed() {
        
        msg = new FacesMessage(FacesMessage.SEVERITY_WARN, "Warning", saveFiled);
        FacesContext.getCurrentInstance().addMessage(null, msg);  
    }
       
    
}
